<template>
  <div class="commentlist" v-if="comments.length">
    <div class="mini-title">评论列表</div>
    <div class="comment-list" v-for="(comment,index) in comments" :key="index" @click='handleClick(comment)'>
      <div class="row">
        <div class="right">{{comment.time}}</div>
        <div class="left">
          <span><img :src="comment.user_info.img" alt=""></span>
          <span>{{comment.user_info.name}}</span>
          <!-- <span class="location">{{comment.location}}</span> -->
          <span class="phone">{{comment.phone}}</span>
        </div>
      </div>
      <div class="conent">
        <p>{{comment.comment}}</p>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props:['comments','type'],
  methods:{
    handleClick(comment){
      if(this.type === 'user'){
        wx.navigateTo({
          url: '/pages/detail/main?id='+comment.bookid
        })
      }
    }
  }
}
</script>

<style lang='scss' scoped>
.commentlist{
  .comment-list{
    padding: 5px;
    border-bottom: 1px solid #eaeaea; 
    .row{
      width: 100%;
      display: inline-block;
      height: 30px;
      line-height: 30px;
      .right{
        float: right;
        font-size: 12px;
        color: #333;
      }
      .left{
        display: inline-block;
        span{
          font-size: 12px;
          color: #333;
          margin-right: 5px;
          img{
            width: 50rpx;
            height: 50rpx;
            border-radius: 50%;
            vertical-align: middle;
          }
          .phone{
            color: #999;
          }
        }
      }
    }
    .conent{
      padding: 5px;
      p{
        line-height: 20px;
        font-size: 12px;
        color: #333;
      }
    }
  }
}
</style>
